/**
 * 2017年7月3日
 */
package org.textplantform.common.core;

import org.textplantform.common.api.core.Result;

/**
 * @author Alex
 *
 */
public class SuccessResult implements Result{
	final Object res;
	public SuccessResult(Object o) {
		if(o instanceof Throwable){
			throw new RuntimeException("请使用ExceptionResult");
		}
		res = o;
	}
	@Override
	public Object getValue() {
		return res;
	}

	@Override
	public Throwable getException() {
		return null;
	}

	@Override
	public boolean hasException() {
		return false;
	}

	@Override
	public ResultType getType() {
		return ResultType.OBJECT;
	}

}
